The present invention relates to technology for obtaining time data directed to monitoring the generation of a selected event and to monitor a change in the event. More specifically, the invention relates to technology that can be effectively adapted to a data processing apparatus such as a micro computer including a timer unit.
In order to obtain time data for monitoring the generation of an event and a change in the event, a conventional timer unit included in the micro computer is provided with a free-running counter and a capture register. The free-running counter is adapted to count basic clock signals of a predetermined frequency. The capture register which latches the counted data of the free-running counter in synchronization with the rise or break of event pulses supplied from an external unit. As the capture register latches the counted data, the timer unit interrupts the central processing unit (hereinafter referred to as CPU) and informs it of the generation or change of a selected event. Then the CPU reads the counted data latched by the capture register and obtains time data related to the generation or change of the event.
For example, when the time between two generated consecutive selected events is to be measured, the CPU transfers the counted data latched by the capture register to a memory to save it and calculates a difference between the latched data in the capture register and the above saved data in order to obtain the elapsed time between the events.
The data processing apparatus, including the timer unit has been disclosed in Japanese Patent Laid-Open No. 3223/1986.
In the prior art, when a second selected event is generated subsequent to the generation of a first event it becomes necessary to save the counted data latched by the capture register in response to the generation of the first selected event before the capture register is renewed by the generation of the second selected event. If the first and second selected events are separated by a short time interval, the processing for saving the latched data into the memory by the CPU may not be carried out before the latched data in the capture register are renewed. Therefore, when measuring pulses having small duration or when measuring pulses separated by a short time interval, the precision of time measurement is limited to the time required by the CPU to make access to the capture register and to save the latched data. Accordingly, the precision of the timer unit for measuring time becomes quite rough.
The object of the present invention is to provide a timer unit capable of improved precision for measuring the time data and for improving limits for measuring a minimum elapsed time.
Another object of the present invention is to provide a data processing apparatus which measures time with high precision.
A further object of the present invention is to provide a data processing apparatus which can easily transfer the timekeeping data among the registers.
The above and other objects as well as novel features of the present invention will become obvious from the description of the specification and the accompanying drawings.